{extend name="public/layouts" /}
{block name="link"}
<link rel="stylesheet" href="__STATIC__/frame/layui/css/layui.css">
<link rel="stylesheet" href="__ADMIN_LAYUI__/css/layui.css">
<link rel="stylesheet" href="__STATIC__/frame/static/css/style.css">
<style>
    .xianz{
        width: 150px;!important;/* 要显示文字的宽度 */
        /*float: left;!* 左对齐，不设置的话只在IE下好用 *!*/
        overflow: hidden; /* 超出的部分隐藏起来 */
        white-space: nowrap;/* 不显示的地方用省略号...代替 */
        text-overflow: ellipsis;/* 支持 IE */
        -o-text-overflow: ellipsis;/* 支持 Opera */
    }
    li{
        margin-left: 5px;
    }
    .imgclss{
        width: 8px!important;
        height: 8px!important;
        position: relative;
        bottom: 10px;
    }
    .layui-layout-admin .layui-body{
        bottom:0px!important;
    }
</style>
{/block}
{block name="script"}
{/block}
{block name="main"}
<div class="layui-layout layui-layout-admin"> <!-- 添加skin-1类可手动修改主题为纯白，添加skin-2类可手动修改主题为蓝白 -->
    <!-- header -->
    <div class="layui-header my-header layui-layout-left">
        <a href="{:url('index/index')}">
            <!--<img class="my-header-logo" src="" alt="logo">-->
            {if getSysTem(1)}
            <div class="my-header-logo xianz">{:getSysTem(1)}</div>
            {else}
            <div class="my-header-logo xianz">{:translateStr('后台管理系统')}</div>
            {/if}
            <div class="my-header-logo" >
                <img src="{:getSysTem(2)}" style="height: 100%;"/>
            </div>
        </a>
        <div class="my-header-btn">
            <button class="layui-btn layui-btn-small btn-nav"><i class="layui-icon">&#xe65f;</i></button>
        </div>
        <ul class="layui-nav">
            <li class="layui-nav-item toubu" data-in="0"><a href="javascript:;">{:translateStr('基础设置')}</a></li>
            <li class="layui-nav-item toubu" data-in="1"><a href="javascript:;">{:translateStr('内容管理')}</a></li>
        </ul>
        <!-- 顶部右侧添加选项卡监听 -->
        <ul class="layui-nav my-header-user-nav" lay-filter="side-top-right">
            {if config('fanyi.open')}
            <li class="layui-nav-item"　id="xiaoxi">
                <form action="" method="post">

                <select name="lang" style="background-color: #CCCCCC"  onchange="tiaozhuan(this)">
                    {foreach $langlist as $key=>$value}
                    {if $key==$lang}
                    <option value="{$key}" selected>{$value}</option>
                    {else}
                    <option value="{$key}">{$value}</option>
                    {/if}
                    {/foreach}
                </select>
                    <button style="display: none"></button>
                </form>
            </li>
            {/if}
            <li class="layui-nav-item" style="cursor: pointer"><a href="javascript:;" href-url="{:url('index/xiaoxi')}">{:translateStr('消息')}<img style="display: none" id="youxiaoxi" src="__STATIC__/admin/img/reddot.png" class="imgclss"></a></li>
            <li class="layui-nav-item">
                <a class="name" href="javascript:;"><i class="layui-icon">&#xe629;</i>{:translateStr('主题')}</a>
                <dl class="layui-nav-child">
                    <dd data-skin="0"><a href="javascript:;">{:translateStr('默认')}</a></dd>
                    <dd data-skin="1"><a href="javascript:;">{:translateStr('纯白')}</a></dd>
                    <dd data-skin="2"><a href="javascript:;">{:translateStr('蓝白')}</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a class="name" href="javascript:;">
                    <img src="{:getFilePath($user['portrait'])}" alt="logo" style="border-radius: 50%">
                    {$user['nickname']??$user['user']}</a>
                <dl class="layui-nav-child">
                    <dd><a href="{:url('index/signin')}"><i class="layui-icon">&#xe621;</i>{:translateStr('登录页')}</a></dd>
                    <dd><a href="javascript:;" onclick="xiangqings('{:url('myadminuser/show_edit')}?id={$user['id']}')" href-url=""><i class="layui-icon">&#xe621;</i>{:translateStr('个人信息')}</a></dd>
                    <dd><a href="{:url('index/out')}"><i class="layui-icon">&#x1006;</i>{:translateStr('退出')}</a></dd>
                </dl>
            </li>
        </ul>

    </div>
    <!-- side -->
    <div class="layui-side my-side">
        <div class="layui-side-scroll">
            <!-- 左侧主菜单添加选项卡监听 -->
            <ul class="layui-nav layui-nav-tree shenti" lay-filter="side-main" >
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon">&#xe631;</i>{:translateStr('基础管理')}</a>
                    <dl class="layui-nav-child">
                        {if getmyauth(['model_id'=>10])}
                        <dd><a href="javascript:;" href-url="{:url('mymodel/show_list?model_id=10')}"><i class="layui-icon">&#xe649;</i>{:translateStr('模型管理')}</a></dd>
                        {/if}
                        {if getmyauth(['model_id'=>14])}
                        <dd><a href="javascript:;" href-url="{:url('typeone/show_list')}?model_id=14"><i class="layui-icon">&#xe649;</i>{:translateStr('模块管理')}</a></dd>
                        {/if}
                        {if getmyauth(['model_id'=>2])}
                        <dd><a href="javascript:;" href-url="{:url('mycolumn/show_list')}?model_id=2"><i class="layui-icon">&#xe649;</i>{:translateStr('栏目管理')}</a></dd>
                        {/if}
                        {if getmyauth(['model_id'=>6])}
                        <dd><a href="javascript:;" href-url="{:url('Enclosure/show_list')}?model_id=6"><i class="layui-icon">&#xe649;</i>{:translateStr('附件管理')}</a></dd>
                        {/if}
<!--                        <dd><a href="javascript:;" href-url="{:url('keywords/show_list')}"><i class="layui-icon">&#xe649;</i>关键词管理</a></dd>-->
                        <!--<dd><a href="javascript:;" href-url="{:url('Huisou/dshow_list')}"><i class="layui-icon">&#xe649;</i>内容回收站</a></dd>-->
                        <dd><a href="javascript:;" href-url="{:url('Huisou/show_list')}"><i class="layui-icon">&#xe649;</i>{:translateStr('内容回收站')}</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon">&#xe674;</i>{:translateStr('后台用户管理')}</a>
                    <dl class="layui-nav-child">
                        {if getmyauth(['model_id'=>1])}
                        <dd><a href="javascript:;" href-url="{:url('myadminuser/show_list')}?model_id=1"><i class="layui-icon">&#xe649;</i>{:translateStr('用户管理')}</a></dd>
                        {/if}
                        {if getmyauth(['model_id'=>12])}
                        <dd><a href="javascript:;" href-url="{:url('myrole/show_list')}?model_id=12"><i class="layui-icon">&#xe649;</i>{:translateStr('角色管理')}</a></dd>
                        {/if}
                        {if getmyauth(['model_id'=>8])}
                        <dd><a href="javascript:;" href-url="{:url('myjur/show_list')}?model_id=8"><i class="layui-icon">&#xe649;</i>{:translateStr('权限管理')}</a></dd>
                        {/if}
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon">&#xe66f;</i>{:translateStr('用户管理')}</a>
                    <dl class="layui-nav-child">
                        {if getmyauth(['cid'=>1])}
                        <dd><a href="javascript:;" href-url="{:url('document/show_list')}?cid=1"><i class="layui-icon">&#xe649;</i>{:translateStr('用户')}</a></dd>
                        {/if}
                        <!--<dd><a href="javascript:;" href-url="<{:url('systems/show_list')}>"><i class="layui-icon">&#xe649;</i>添加配置</a></dd>-->
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon">&#xe614;</i>{:translateStr('系统管理')}</a>
                    <dl class="layui-nav-child">
                        <!--<dd><a href="javascript:;" href-url="<{:url('systems/show_edit')}>"><i class="layui-icon">&#xe649;</i>更改配置</a></dd>-->
                        {if config('app.addsystem')}
                        {if getmyauth(['model_id'=>13])}
                        <dd><a href="javascript:;" href-url="{:url('mysystems/show_list')}?model_id=13"><i class="layui-icon">&#xe649;</i>{:translateStr('配置管理列表')}</a></dd>
                        {/if}
                        {/if}
                        {foreach $systems as $vs}
                        {if getmyauth(['model_id'=>13])}
                        <dd><a href="javascript:;" href-url="{:url('stesystem/show_list')}?en_name={$vs['en_name']}"><i class="layui-icon">&#xe649;</i>{:translateStr($vs['en_name'])}</a></dd>
                        {/if}
                        {/foreach}
<!--                        <dd><a href="javascript:;" href-url="{:url('wechats/show_list')}"><i class="layui-icon">&#xe649;</i>微信管理</a></dd>-->
                        <!--<dd><a href="javascript:;" href-url="{:url('linkai/show_list')}"><i class="layui-icon">&#xe649;</i>凌凯短信管理</a></dd>-->
                    </dl>
                </li>
                <li class="layui-nav-item" style="display: none">
                    <a href="javascript:;"><i class="layui-icon">&#xe628;</i>{:translateStr('数据库备份管理')}</a>
                    <dl class="layui-nav-child">
                        <!--<dd><a href="javascript:;" href-url="<{:url('systems/show_edit')}>"><i class="layui-icon">&#xe649;</i>更改配置</a></dd>-->
                        <dd><a href="javascript:;" href-url="{:url('databassystem/show_list')}"><i class="layui-icon">&#xe649;</i>{:translateStr('数据库备份配置管理')}</a></dd>
                        <dd><a href="javascript:;" href-url="{:url('beifen/show_list')}"><i class="layui-icon">&#xe649;</i>{:translateStr('数据库备份管理')}</a></dd>
                    </dl>
                </li>
            </ul>
            <ul class="layui-nav layui-nav-tree shenti" lay-filter="side-main" style="display: none">
                {foreach $mokuai as $mok}
                {if $mok['show']}
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon">&#xe68e;</i>{$mok['name']}</a>
                    <dl class="layui-nav-child">
                        {foreach $mok['lianbiao'] as $value}
                        {if getmyauth(['model_id'=>$value['id']])}
                        <dd>
                            <a href="javascript:;" onclick="tuozhan(this,0)" href-url="{:url($value['action'])}?model_id={$value['id']}"><i class="layui-icon">&#xe649;</i>{$value['name']}</a>
                        </dd>
                        {/if}
                        {/foreach}
                        {foreach $mok['column'] as $value}
                        {if getmyauth(['cid'=>$value['id']])}
                        <dd>
                            <a href="javascript:;" onclick="tuozhan(this,0)" {if $value['model_id']}href-url="{:url($value['action'])}?cid={$value['id']}"{/if}><i class="layui-icon">&#xe649;</i>{$value['name']}</a>
                        </dd>
                        {/if}
                        {if $value['child']}
                        <dl class="layui-nav-child" style="display: none">
                            {foreach $value['child'] as $v}
                            {if getmyauth(['cid'=>$v['id']])}
                            <dd>
                                <a href="javascript:;" onclick="tuozhan(this,0)" {if !$v['child']}style="margin-left: 20px"{/if} {if $v['model_id']}href-url="{:url($v['action'])}?cid={$v['id']}"{/if}>{php}echo str_repeat('&nbsp;&nbsp;',$v['cheng']);{/php}{if $v['child']}<i class="layui-icon">&#xe671;</i>{/if}{$v['name']}</a>
                            </dd>
                            {/if}
                            {if $v['child']}
                            <dl class="layui-nav-child" style="display: none">
                                {foreach $v['child'] as $va}
                                {if getmyauth(['cid'=>$va['id']])}
                                <dd>
                                    <a href="javascript:;" style="margin-left: 40px" {if $value['model_id']}href-url="{:url($va['action'])}?cid={$va['id']}"{/if}>{php}echo str_repeat('&nbsp;&nbsp;',$va['cheng']);{/php}{$va['name']}</a>
                                </dd>
                                {/if}
                                {/foreach}
                            </dl>
                            {/if}
                            {/foreach}
                        </dl>
                        {/if}
                        {/foreach}
                    </dl>
                </li>
                {/if}
                {/foreach}
            </ul>
        </div>
    </div>
    <!-- body -->
    <div class="layui-body my-body" style="text-align: center">
        <div class="layui-tab layui-tab-card my-tab" lay-filter="card" lay-allowClose="true">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="1"><span><i class="layui-icon">&#xe638;</i>{:translateStr('欢迎页')}</span></li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show" style="height: 100%">
                    <iframe id="iframe" src="{:url('index/welcome')}" frameborder="0"></iframe>
                </div>
            </div>
        </div>
    </div>
    <!-- footer -->
<!--    <div class="layui-footer my-footer">-->

<!--    </div>-->
</div>
{/block}
{block name="footer"}
<script type="text/javascript" src="__STATIC__/frame/layui/layui.js"></script>
<script type="text/javascript" src="__ADMIN_JS__/MaoWenKe.js"></script>
<script type="text/javascript" src="__STATIC__/frame/static/js/vip_comm.js"></script>
{/block}
{block name='javascript'}
<script type="text/javascript">
    layui.use(['layer','vip_nav'], function () {

        // 操作对象
        var layer       = layui.layer
            ,vipNav     = layui.vip_nav
            ,$          = layui.jquery;

        // 顶部左侧菜单生成 [请求地址,过滤ID,是否展开,携带参数]
        vipNav.top_left('./json/nav_top_left.json','side-top-left',false);
        // 主体菜单生成 [请求地址,过滤ID,是否展开,携带参数]
        vipNav.main('./json/nav_main.json','side-main',true);

        // you code ...
        var shenti = $(".shenti");
        $.each(shenti,function (i,v) {
            if(i==0){
                $(v).show();
            }else{
                $(v).hide();
            }
        })

    });
    function tuozhan(obj,num) {
        var nex = $(obj).parent('dd').next('dl');
        if(num==0){
            nex.show();
            $(obj).attr('onclick','tuozhan(this,1)')
        }else {
            nex.hide();
            $(obj).attr('onclick','tuozhan(this,0)')
        }
    }
     // $.post("{:url('index/zidongbeifen')}",{id:1},function (res) {
     //     console.log(res)
     // })
     // setInterval(function () {
     //     $.post("{:url('index/zidongbeifen')}",{id:1},function (res) {
     //         console.log(res)
     //     })
     // },3600*1000);
    $('.toubu').click(function () {
        var index = $(this).attr('data-in');
        var shenti = $(".shenti");
        $.each(shenti,function (i,v) {
            if(i==index){
                $(v).show();
            }else{
                $(v).hide();
            }
        })
    })
    function xiangqings(url) {
        layer.open({
            type:2,
            area:['50%','80%'],
            content:url,
            // end:function () {
            //     onreloader();
            // }
        })
    }
    function getpost(tiaojian) {
        setTimeout(function () {
            $.ajax({
                url:"{:url('api/fanyi')}",
                data:tiaojian,
                async:true,
                success:function (res) {
                    console.log(res);
                    if(res.code==200){
                        location.reload();
                    }else{
                        getpost(tiaojian);
                    }
                },
                error:function () {
                    getpost(tiaojian);
                }
            })
        },1000)
    }
    function tiaozhuan(obj) {
        var str = $(obj).val();
        var index = layer.load(0, {shade: false});
        // $.post("{:url('api/fanyi')}",{lang:str},function (res) {
        //     console.log(res);
        // });
        getpost({lang:str});
    }
    function youxiaoxi() {
        $.post("{:url('api/getadminmessage')}",{},function (res) {
            if(res.code==200){
                $("#youxiaoxi").show();
            }else{
                $("#youxiaoxi").hide();
            }
        })
    }
    // setInterval(youxiaoxi,500);

</script>
{/block}